package com.liu.stockmarket.model

class ResponseResult<T>(
    val code: Int,
    val message: String,
    val data: T? = null
) {


    companion object {
        const val SUCCESS = 0
        const val ERROR = -1
        fun <T> success(): ResponseResult<T> {
            return ResponseResult(SUCCESS, "成功")
        }

        fun <T> success(data: T): ResponseResult<T> {
            return ResponseResult(SUCCESS, "成功", data)
        }

        fun <T> error(message: String): ResponseResult<T> {
            return ResponseResult(ERROR, message)
        }
    }
}